// src/workers/myWorker.worker.js

self.onmessage = function(e) {
  const data = e.data;
  // 模拟耗时操作
  let result = performHeavyComputation(data);

  // 将结果返回给主线程
  self.postMessage(result);
};

function performHeavyComputation(input) {
  // 这里放置需要在后台执行的逻辑
  return input + " processed by worker";
}